home *** CD-ROM | disk | FTP | other *** search
- // Copyright (C) 1997-2002 Alias|Wavefront,
- // a division of Silicon Graphics Limited.
- //
- // The information in this file is provided for the exclusive use of the
- // licensees of Alias|Wavefront. Such users have the right to use, modify,
- // and incorporate this code into other products for purposes authorized
- // by the Alias|Wavefront license agreement, without fee.
- //
- // ALIAS|WAVEFRONT DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
- // INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
- // EVENT SHALL ALIAS|WAVEFRONT BE LIABLE FOR ANY SPECIAL, INDIRECT OR
- // CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
- // DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
- // TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
- // PERFORMANCE OF THIS SOFTWARE.
- //
- // This method brings up the basic framework of
- // the tool property sheet.
- //
- // All the individual property sheets place themselves
- // within this framework.
-
- global proc toolPropertyWinSetCommon(string $toolName, string $icon)
- {
- print ("The procedure \"toolPropertyWinSetCommon\" is obsolete.\n");
- print ("Please use \"toolPropertySetCommon\" instead.\n");
- error ("Obsolete procedure");
- }
-
- // Set up the common properties needed for all tools
- // This is : name, icon, help doc
- //
- global proc toolPropertySetCommon(string $name, string $icon, string $help)
- {
- // If we are displaying the icon, set it for the tool
- //
- string $image = `toolPropertyWindow -query -icon`;
- if ($image != "") picture -edit -image $icon $image;
-
- string $nameField = `toolPropertyWindow -query -field`;
- string $reset = `toolPropertyWindow -query -resetButton`;
- string $helpButton = `toolPropertyWindow -query -helpButton`;
-
- if ($help != "") {
- string $cmd = "showHelp "+$help;
- button -edit -enable true -command $cmd $helpButton;
- } else {
- button -edit -enable false $helpButton;
- }
-
- string $toolCtxName;
- if ( `contextInfo -exists $name` ){
- $toolCtxName = `contextInfo -t $name`;
- button -edit -enable true $reset;
- } else {
- $toolCtxName = "Channel Box Manipulator";
- button -edit -enable false $reset;
- }
- text -edit -label $toolCtxName $nameField;
- button -edit -command ("resetTool " + $name) $reset;
- }
-
-
- global proc toolPropertyShow() {
- if (`window -exists toolProperties`) {
- //
- // Bug fix #145854. Calling the "showWindow" command on NT
- // has the effect of giving that window focus. Consequently,
- // that takes keyboard focus away from the main Maya window
- // and hotkeys are no longer active.
- //
- // Don't want to call showWindow on Irix either because it
- // has the annoying behaviour of popping the window to the
- // front.
- //
- if (!`window -query -visible toolProperties`) {
- showWindow toolProperties;
- }
- }
- }
-
- global proc toolPropertySelect(string $whichPropSheet) {
- string $parent = `toolPropertyWindow -query -location`;
- setParent $parent;
- tabLayout -edit -selectTab $whichPropSheet $parent;
- toolPropertyShow();
- }
-
- proc createToolSettingsWindow()
- {
- global string $gToolSettingsSeparateWindowLocation;
- global string $gToolSettingsSeparateWindowIcon;
- global string $gToolSettingsSeparateWindowName;
- global string $gToolSettingsSeparateWindowResetButton;
- global string $gToolSettingsSeparateWindowHelpButton;
-
- string $window = `window
- -title "Tool Settings"
- -iconName "Tools"
- -width 428
- -height 500
- toolProperties`;
-
- string $form = `formLayout toolProperties_C`;
-
- string $imageAndNameForm = `formLayout`;
-
- string $image = `picture -image "vacantCell.xpm" toolSmallIcon`;
- string $name = `text -label "" -align "left"`;
-
- setParent ..;
-
- formLayout -edit
- -attachForm $image "top" 1
- -attachForm $image "left" 2
- -attachNone $image "bottom"
- -attachNone $image "right"
-
- -attachForm $name "top" 10
- -attachControl $name "left" 5 $image
- -attachNone $name "bottom"
- -attachNone $name "right"
-
- $imageAndNameForm;
-
- // Add this in so we can load in help icons when required
- //
- columnLayout helpIconArea;
- setParent ..;
-
- string $targetName = `tabLayout
- -scrollable true
- -tabsVisible false
- -innerMarginWidth 5
- -innerMarginHeight 5
- context_T`;
- setParent ..;
-
- string $reset = `button -label "Reset Tool"`;
- string $help = `button -label "Tool Help..."`;
- string $close = `button -label "Close"
- -command ("deleteUI toolProperties")`;
-
- formLayout -e
- -attachForm $imageAndNameForm "top" 0
- -attachForm $imageAndNameForm "left" 0
- -attachForm $imageAndNameForm "right" 0
-
- -attachControl helpIconArea "top" 0 $imageAndNameForm
- -attachForm helpIconArea "left" 0
- -attachForm helpIconArea "right" 0
-
- -attachControl $targetName "top" 0 helpIconArea
- -attachForm $targetName "left" 0
- -attachForm $targetName "right" 0
- -attachControl $targetName "bottom" 2 $close
-
- -attachNone $reset "top"
- -attachForm $reset "left" 2
- -attachForm $reset "bottom" 2
- -attachPosition $reset "right" 1 33
-
- -attachNone $help "top"
- -attachPosition $help "left" 1 33
- -attachForm $help "bottom" 2
- -attachPosition $help "right" 1 66
-
- -attachPosition $close "left" 1 66
- -attachForm $close "bottom" 2
- -attachForm $close "right" 2
- -attachNone $close "top"
- $form;
- setParent ..;
-
- $gToolSettingsSeparateWindowLocation = $targetName;
- $gToolSettingsSeparateWindowIcon = $image;
- $gToolSettingsSeparateWindowName = $name;
- $gToolSettingsSeparateWindowResetButton = $reset;
- $gToolSettingsSeparateWindowHelpButton = $help;
-
- redirectToolSettings("Separate Window");
- }
-
- proc showToolProperties(string $location)
- //
- // Description:
- // Show the tool properties in the specified location.
- //
- // Arguments:
- // $location - Either "Main Window" or "Separate Window".
- //
- {
- // This is the name of the window containing the Tool Settings.
- //
- string $toolPropertiesWindow = "toolProperties";
-
- // Determine if the Tool Settings are currently displayed in
- // a separate window.
- //
- int $windowVisible = false;
- if (`window -exists toolProperties`) {
- $windowVisible = `window -query -visible toolProperties`;
- }
-
- // Determine if the Tool Settings are currently displayed in the
- // main Maya window.
- //
- int $componentVisible = `isUIComponentVisible("Tool Settings")`;
-
- if ("Separate Window" == $location) {
-
- if ($windowVisible) {
- //
- // Tool Settings are already in a separate window.
- //
- // Make sure the window is visible.
- //
- showWindow $toolPropertiesWindow;
-
- } else {
- //
- // Hide the Tool Settings component.
- //
- if ($componentVisible) {
- toggleUIComponentVisibility("Tool Settings");
- }
-
- //
- // Delete contents of Tool Settings component if necessary.
- //
- // Don't actually delete all the Tool Settings component contents.
- // Just delete all the children of the tab layout save for one.
- //
- global string $gToolSettingsForm;
-
- string $childArray[] = `layout -query -childArray $gToolSettingsForm`;
- int $index;
-
- for ($child in $childArray) {
- if ("tabLayout" == `objectTypeUI $child`) {
- $childArray = `tabLayout -query -childArray $child`;
- for ($index = 1; $index < size($childArray); $index++) {
- deleteUI $childArray[$index];
- }
- break;
- }
- }
-
- // Create the Tool Settings window.
- //
- createToolSettingsWindow();
- }
-
- } else if ("Main Window" == $location) {
-
- if ($windowVisible) {
- //
- // Delete the Tool Settings window.
- //
- deleteUI -window $toolPropertiesWindow;
-
- // Create the Tool Settings component contents.
- //
-
- // Show the Tool Settings component.
- //
- if (!$componentVisible) {
- toggleUIComponentVisibility("Tool Settings");
- }
-
- } else if ($componentVisible) {
- //
- // Tool Settings component is already visible.
- //
-
- } else {
- //
- // Delete the Tool Settings window if necessary.
- //
- if (`window -exists toolProperties`) {
- deleteUI -window $toolPropertiesWindow;
- }
-
- // Create the Tool Settings component conetents if necessary.
- //
-
- // Show the Tool Settings component.
- //
- toggleUIComponentVisibility("Tool Settings");
- }
-
- } else {
- //
- // Nothing to do here because the Tool Settings are visible in
- // either a window or the component.
- //
- }
- }
-
- global proc toolPropertyWindow1(string $location) {
-
- if ("" == $location) {
- //
- // Determine if the Tool Settings are currently displayed in
- // a separate window.
- //
- int $windowVisible = false;
- if (`window -exists toolProperties`) {
- $windowVisible = `window -query -visible toolProperties`;
- }
-
- // Determine if the Tool Settings are currently displayed in the
- // main Maya window.
- //
- int $componentVisible = `isUIComponentVisible("Tool Settings")`;
-
- if ($windowVisible) {
- //
- // Window is up so use that location.
- //
- $location = "Separate Window";
-
- } else if ($componentVisible) {
- //
- // Component is up so use that location.
- //
- $location = "Main Window";
-
- } else {
- //
- // Use the user's preferred location.
- //
- if (`optionVar -query toolSettingsInMainWindow`) {
- $location = "Main Window";
- } else {
- $location = "Separate Window";
- }
- }
- }
-
- showToolProperties($location);
- }
-